import request from '@/utils/http'

export function getCategoryAPI(id) {
    return request({
        url: `/category`,
        params: {
            id
        }
    })
}

/**
 * 获取二级分类数据列表
 * /category接口:返回格式:
 * {
    "code": "1",
    "msg": "操作成功",
    "result": {
        "id": "1005000",
        "name": "居家",
        "picture": null,
        "children": [
            {
                "id": "1005999003", // 二级分类id
                "name": "居家生活用品", // 二级分类名
                "picture": "http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-22/7f6a7b20-7902-4b43-b9c5-f33151ef1334.jpg", // 二级分类图片
                "parentId": null,
                "parentName": null,
                "goods": [
                    {
                        "id": "1379052170040578049",
                        "name": "极光限定 珠光蓝珐琅锅",
                        "desc": null,
                        "price": "199.00",
                        "picture": "http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-05/7f483771-6831-4a7a-abdb-2625acb755f3.png",
                        "orderNum": 58
                    },
                    {
                        "id": "1369155859933827074",
                        "name": "钻石陶瓷涂层多用锅18cm 小奶锅",
                        "desc": "安全耐用，易于清洗",
                        "price": "149.00",
                        "picture": "http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-05/6fdcac19-dd44-442c-9212-f7ec3cf3ed18.jpg",
                        "orderNum": 1104
                    }
                ],
                "categories": null,
                "brands": null,
                "saleProperties": null
            },
            {
                "id": "1008017",
                "name": "收纳",
                "picture": "https://yanxuan.nosdn.127.net/366989e4d730594e86fcd60b5ab19acc.png",
                "parentId": null,
                "parentName": null,
                "goods": [
                    {
                        "id": "1225018",
                        "name": "可水洗的布艺收纳盒",
                        "desc": "三种规格，收纳杂物",
                        "price": "29.90",
                        "picture": "https://yanxuan-item.nosdn.127.net/5a608974e36c829898df20fd0ebf184a.png",
                        "orderNum": 443
                    },
                    {
                        "id": "1028003",
                        "name": "全能收纳王，棉麻涤·收纳盒",
                        "desc": "结实棉麻，大容量收纳",
                        "price": "36.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/8efa36e2d40cf007f9b0982a952dd8f1.png",
                        "orderNum": 229
                    },
                    {
                        "id": "1075011",
                        "name": "拉开抽屉不凌乱，磨砂抽屉整理盒套装",
                        "desc": "灵活组合，多场景适用",
                        "price": "49.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/9382826c5a4bf31d7d1c827fec50e05b.png",
                        "orderNum": 126
                    },
                    {
                        "id": "1131025",
                        "name": "开发员自留款，带滚轮双层脏衣篓",
                        "desc": "滚轮设计，双层收纳",
                        "price": "125.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/8147e4685e5a0e47c1624772ee868fcc.jpg",
                        "orderNum": 560
                    },
                    {
                        "id": "1252031",
                        "name": "换季好帮手，大容量防尘衣物收纳袋",
                        "desc": "棉被收纳，干净防尘",
                        "price": "69.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/75f6cc2c037c09e957cbcc336cf4a652.png",
                        "orderNum": 404
                    }
                ],
                "categories": null,
                "brands": null,
                "saleProperties": null
            },
            {
                "id": "1017000",
                "name": "宠物食品",
                "picture": "https://yanxuan.nosdn.127.net/b42a85ef15f856081ea9f49e5f6893e2.png",
                "parentId": null,
                "parentName": null,
                "goods": [
                    {
                        "id": "3406025",
                        "name": "多重口味，原肉蒸煮，清煮肉罐（猫）85克",
                        "desc": "原肉盛宴，大粒可见",
                        "price": "9.90",
                        "picture": "https://yanxuan-item.nosdn.127.net/4128d962f1d621d516c6b850cbb8abfe.png",
                        "orderNum": 147
                    },
                    {
                        "id": "3408074",
                        "name": "可爱健康不要胖，全价成猫粮（阶段）",
                        "desc": "维持体态，促排毛球",
                        "price": "99.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/fb010b57768a72421cc9b12fad9c7444.png",
                        "orderNum": 190
                    },
                    {
                        "id": "3425018",
                        "name": "定制配方，专属营养，全价小型犬犬粮",
                        "desc": "呵护肠胃，美毛亮毛补营养",
                        "price": "69.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/ef56a7139fffe2650a7cd74deafd08da.png",
                        "orderNum": 178
                    },
                    {
                        "id": "3847005",
                        "name": "浓缩的精华，宠物化毛营养膏120克/支",
                        "desc": "温和化毛，补充营养，二合一",
                        "price": "39.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/a36c88ef48b14320166fab465686479f.jpg",
                        "orderNum": 214
                    },
                    {
                        "id": "3407081",
                        "name": "全面助力发育，全价幼猫粮（阶段）1.8千克",
                        "desc": "营养易吸收，严苛选料，健康成长",
                        "price": "99.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/395e781595f60b4e2c7aaab2420da3cd.png",
                        "orderNum": 126
                    }
                ],
                "categories": null,
                "brands": null,
                "saleProperties": null
            },
            {
                "id": "109243003",
                "name": "艺术藏品",
                "picture": "https://yanxuan.nosdn.127.net/9544b81aaa14c26a8038c2365ff3c2bc.png",
                "parentId": null,
                "parentName": null,
                "goods": [
                    {
                        "id": "4008506",
                        "name": "平步青云财神家居摆件",
                        "desc": "艺术家瞿广慈作品，手绘上色，礼盒包装",
                        "price": "646.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/9d5d0083264344b5d85acde13570d025.jpg",
                        "orderNum": 207
                    },
                    {
                        "id": "4001880",
                        "name": "朱炳仁·铜彩色生肖铜雕摆件",
                        "desc": "十二生肖萌宝系列吉祥物，吉祥又好运",
                        "price": "680.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/04753036f123a8ff1b56db60fe440f47.jpg",
                        "orderNum": 128
                    },
                    {
                        "id": "3993860",
                        "name": "国大师匠造落款宫廷聚宝缸摆件",
                        "desc": "生财聚宝,藏风聚气,",
                        "price": "508.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/a4e343fcffdb13eaf37428ad851dfb2a.png",
                        "orderNum": 107
                    },
                    {
                        "id": "4001877",
                        "name": "朱炳仁·铜忠义千秋关公风水摆件",
                        "desc": "众今礼敬关二爷，祈愿慈恩常荫庇",
                        "price": "4280.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/cd9060820a1a52f296fa2502e56a5872.jpg",
                        "orderNum": 171
                    },
                    {
                        "id": "4000295",
                        "name": "星云吉彩系列花器新年创意花瓶摆件朱炳仁",
                        "desc": "星云吉彩，一路繁花。花瓶造型挺秀、俏丽，更为丰满圆润；五彩斑斓色彩，莹润光泽的质感，又显娇嫩。置于台前感受花与花器的和谐之美，获得精神的美感和愉悦。采用国家非遗百年传统工艺及国艺釉彩铜独创工艺，简约时尚的设计，雅致意趣。",
                        "price": "442.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/2dd8fe9b59774c7ca160bb2d5741c763.jpg",
                        "orderNum": 133
                    }
                ],
                "categories": null,
                "brands": null,
                "saleProperties": null
            },
            {
                "id": "109248004",
                "name": "宠物用品",
                "picture": "https://yanxuan.nosdn.127.net/e766b09029ca00680d1e651b5cdc42bd.png",
                "parentId": null,
                "parentName": null,
                "goods": [
                    {
                        "id": "4000278",
                        "name": "不易带出，3毫米原味豆腐猫砂2.6千克",
                        "desc": "经典3mm颗粒，强吸水，强包裹",
                        "price": "29.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/9d9590bdb4f7cdd874de6a4554abcff9.jpg",
                        "orderNum": 134
                    },
                    {
                        "id": "3990698",
                        "name": "三重除臭，高效结团，混合猫砂2.5千克",
                        "desc": "科学配比，四效合一",
                        "price": "29.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/93b61911db2b55185aefd4b92bc52d26.png",
                        "orderNum": 301
                    },
                    {
                        "id": "3990319",
                        "name": "智能饮水机滤芯三片装",
                        "desc": "生物感应，紫外除菌，健康活泉",
                        "price": "42.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/240983ccc935146a4795e3990d30468d.jpg",
                        "orderNum": 98
                    },
                    {
                        "id": "3434008",
                        "name": "木天蓼逗猫棍",
                        "desc": "零食玩具，互动磨牙",
                        "price": "16.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/674ec7a88de58a026304983dd049ea69.jpg",
                        "orderNum": 108
                    },
                    {
                        "id": "3986658",
                        "name": "快速吸水防回渗，宠物训导垫S码80片/袋",
                        "desc": "漏斗般吸水，一垫多用更省心",
                        "price": "35.80",
                        "picture": "https://yanxuan-item.nosdn.127.net/17f5a18b4125733023cad09d6b7852db.jpg",
                        "orderNum": 262
                    }
                ],
                "categories": null,
                "brands": null,
                "saleProperties": null
            },
            {
                "id": "109293000",
                "name": "家庭医疗",
                "picture": "https://yanxuan.nosdn.127.net/3f34039fa8c26e18e2f4fc96ed8cb6de.png",
                "parentId": null,
                "parentName": null,
                "goods": [
                    {
                        "id": "3997406",
                        "name": "支撑颈椎无负担，颈椎固定器",
                        "desc": "0.23KG轻量化设计，支撑颈椎，低头族救星",
                        "price": "299.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/0cdfd546f8675669b87716114ad5900a.jpg",
                        "orderNum": 138
                    },
                    {
                        "id": "3997974",
                        "name": "入门首选，语音播报电子血压计",
                        "desc": "全程语音指导，一键测量，监测心率，贴心守护爸妈健康",
                        "price": "109.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/8f0c15f981c5cbcb1aa17215a259fa62.png",
                        "orderNum": 128
                    },
                    {
                        "id": "3987635",
                        "name": "语音播报，臂式测量血压计",
                        "desc": "臂式测量更准确，给爸妈的礼物",
                        "price": "219.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/a153def14233781de524ba184389855c.jpg",
                        "orderNum": 85
                    },
                    {
                        "id": "3995913",
                        "name": "家庭常备红外线耳温式体温计",
                        "desc": "耳温式体温计测量更准确",
                        "price": "139.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/cb09d868c280608a29c1d131dbc08061.jpg",
                        "orderNum": 106
                    },
                    {
                        "id": "1477017",
                        "name": "居家旅行常备家用医疗包（含医疗用品）",
                        "desc": "装备齐全，我的随行医护师",
                        "price": "59.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/4aec56f5a1af7c3538e47acf301ad15b.png",
                        "orderNum": 133
                    }
                ],
                "categories": null,
                "brands": null,
                "saleProperties": null
            },
            {
                "id": "109308000",
                "name": "中医保健",
                "picture": "https://yanxuan.nosdn.127.net/2bfba997fd031317caecc4f0bad17569.png",
                "parentId": null,
                "parentName": null,
                "goods": [
                    {
                        "id": "3993828",
                        "name": "七夕礼物·姐姐同款，穿出自信体态矫姿带",
                        "desc": "背薄一寸，年轻十岁，时尚百搭，约会职场小心机",
                        "price": "159.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/a6939f41c48fa9e9c8f7a7ed855351f1.jpg",
                        "orderNum": 235
                    },
                    {
                        "id": "3997602",
                        "name": "暖腰暖腹暖胃，蕲艾暖宫腰带",
                        "desc": "暖宫暖腰暖胃，大面积热敷≈3片暖宝宝",
                        "price": "49.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/9892cc73945da1591fa5259ad076b23c.jpg",
                        "orderNum": 190
                    },
                    {
                        "id": "3995284",
                        "name": "新年佳礼，家用SPA多功能按摩床垫",
                        "desc": "坐卧两用，随时随地做spa，多个场合随你心意",
                        "price": "599.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/c41003c6df90d7673195dcc2482e13f3.jpg",
                        "orderNum": 167
                    },
                    {
                        "id": "3993481",
                        "name": "带提手可站立炫彩硅胶热水袋",
                        "desc": "杯型式设计，轻松注水防烫伤",
                        "price": "35.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/0b120e1c37f312981f4f2242997cc862.png",
                        "orderNum": 187
                    },
                    {
                        "id": "3991840",
                        "name": "消炎镇痛一贴灵医用冷敷贴60贴/盒",
                        "desc": "mini型尺寸设计性价比更高",
                        "price": "79.00",
                        "picture": "https://yanxuan-item.nosdn.127.net/d3807695c7d42a0247e308a936201d7c.jpg",
                        "orderNum": 139
                    }
                ],
                "categories": null,
                "brands": null,
                "saleProperties": null
            }
        ]
    }
}
 */


/**
 * @description: 获取二级分类列表数据和父级
 * @param {*} id 分类id 
 * @return {*}
 */
export const getCategoryFilterAPI = (id) => {
    return request({
        url: '/category/sub/filter',
        params: {
            id
        }
    })
}

/**
 *  获取二级分类列表数据
 * /category/sub/filter接口:返回格式:
 * {
    "code": "1",
    "msg": "操作成功",
    "result": {
        "id": "1005999003",     // 二级分类id
        "name": "居家生活用品",  // 二级分类名
        "picture": null,
        "parentId": "1005000",  // 父级分类id
        "parentName": "居家",   // 父级分类名
        "goods": [
            {
                "id": "1379052170040578049",
                "name": "极光限定 珠光蓝珐琅锅",
                "desc": null,
                "price": "199.00",
                "picture": "http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-05/7f483771-6831-4a7a-abdb-2625acb755f3.png",
                "orderNum": 58
            },
            {
                "id": "1369155859933827074",
                "name": "钻石陶瓷涂层多用锅18cm 小奶锅",
                "desc": "安全耐用，易于清洗",
                "price": "149.00",
                "picture": "http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-05/6fdcac19-dd44-442c-9212-f7ec3cf3ed18.jpg",
                "orderNum": 1104
            }
        ],
        "categories": [
            {
                "id": "1005999003",
                "name": "居家生活用品",
                "layer": 2,
                "parent": null
            },
            {
                "id": "1008017",
                "name": "收纳",
                "layer": 2,
                "parent": null
            },
            {
                "id": "1017000",
                "name": "宠物食品",
                "layer": 2,
                "parent": null
            },
            {
                "id": "109243003",
                "name": "艺术藏品",
                "layer": 2,
                "parent": null
            },
            {
                "id": "109248004",
                "name": "宠物用品",
                "layer": 2,
                "parent": null
            },
            {
                "id": "109293000",
                "name": "家庭医疗",
                "layer": 2,
                "parent": null
            },
            {
                "id": "109308000",
                "name": "中医保健",
                "layer": 2,
                "parent": null
            }
        ],
        "brands": [],
        "saleProperties": []
    }
}
 */

/**
 * @description: 获取二级分类下列表数据
 * @data { 
     categoryId: 1005000 ,
     page: 1,
     pageSize: 20,
     sortField: 'publishTime' | 'orderNum' | 'evaluateNum'
   } 
 * @return {*}
 */
   export const getSubCategoryAPI = (data) => {
    return request({
      url:'/category/goods/temporary',
      method:'POST',
      data
    })
  }

  /**  
   * 获取二级分类下列表数据
   * /category/goods/temporary接口:返回格式:
   * {
    "result": {
        "counts": 345,
        "pageSize": 20,
        "pages": 18,
        "page": 1,
        "items": [
            {
                "id": "1379052170040578049",
                "name": "极光限定 珠光蓝珐琅锅",
                "desc": null,
                "price": "199.00",
                "picture": "http://yjy-xiaotuxian-dev.oss-cn-beijing.aliyuncs.com/picture/2021-04-05/7f483771-6831-4a7a-abdb-2625acb755f3.png",
                "orderNum": 58
            },
            {
                "id": "4000102",
                "name": "男式零感无压加厚保暖羽绒服",
                "desc": "为「轻暖」而生",
                "price": "409.00",
                "picture": "https://yanxuan-item.nosdn.127.net/0ff69c2099d98aa3cdddcb0edb9108a0.png",
                "orderNum": 14
            },
            {
                "id": "4023738",
                "name": "舒适软弹，糖果色儿童网孔透气运动鞋25-30",
                "desc": "防踢鞋头，透气网孔更舒适",
                "price": "139.00",
                "picture": "https://yanxuan-item.nosdn.127.net/c437179bc1d0d5ad77a79f15a5c6f166.png",
                "orderNum": 5
            },
            {
                "id": "1545002",
                "name": "三分钟即享简餐，日式即食咖喱150克",
                "desc": "日式风味，甘香醇厚",
                "price": "15.00",
                "picture": "https://yanxuan-item.nosdn.127.net/3a3d282779030c70e67dc0825ede50d3.png",
                "orderNum": 88
            },
            {
                "id": "3440042",
                "name": "超细纤维擦车厨房多用清洁抹布",
                "desc": "超细纤维，清洁加倍不伤车身",
                "price": "21.90",
                "picture": "https://yanxuan-item.nosdn.127.net/0c0691b4ac8c491142d6a74750c5c606.jpg",
                "orderNum": 64
            },
            {
                "id": "1076003",
                "name": "可替换头，蜂窝海绵洗杯刷",
                "desc": "好洗快干，刷头可更换",
                "price": "9.90",
                "picture": "https://yanxuan-item.nosdn.127.net/b2a1f9e90f7e7a63227dc22ce52ea579.png",
                "orderNum": 142
            },
            {
                "id": "1468020",
                "name": "防磨脚防水泡神器，水胶体创口贴10片装",
                "desc": "水胶湿性愈合，防止留疤",
                "price": "19.90",
                "picture": "https://yanxuan-item.nosdn.127.net/02bab6fbc0bf8c32d74ec116d00b7277.png",
                "orderNum": 80
            },
            {
                "id": "1494003",
                "name": "强效去油不伤手日本橙油除油污泡沫400ml",
                "desc": "强力除油污，萃取橙油精华",
                "price": "29.90",
                "picture": "https://yanxuan-item.nosdn.127.net/a263180ad8c46865cf5e7ff9fa57b63f.png",
                "orderNum": 104
            },
            {
                "id": "1269010",
                "name": "什锦素食粥米500克",
                "desc": "谷香米糯，营养美味",
                "price": "9.90",
                "picture": "https://yanxuan-item.nosdn.127.net/dc4826ddb838d8e17f90402adfa3f4fe.png",
                "orderNum": 87
            },
            {
                "id": "3995846",
                "name": "加绒加厚，儿童保暖时尚卫衣套装73-120cm",
                "desc": "舒棉绒内里，抵御寒冬",
                "price": "199.00",
                "picture": "https://yanxuan-item.nosdn.127.net/21d2e9b754487aa3030ce105493a9473.jpg",
                "orderNum": 181
            },
            {
                "id": "1667068",
                "name": "新潮运动底，女式保暖皮毛一体雪地靴",
                "desc": "澳洲羊皮毛一体，保暖舒适",
                "price": "319.00",
                "picture": "https://yanxuan-item.nosdn.127.net/93efb5e64a554e98d2d11c0a322b08f6.png",
                "orderNum": 606
            },
            {
                "id": "1193027",
                "name": "MFI认证苹果快充数据线",
                "desc": "xingpai智造苹果快充数据线（1米升级加固版）",
                "price": "49.00",
                "picture": "https://yanxuan-item.nosdn.127.net/06d3a89ce18f0ae6360b9cd288084045.png",
                "orderNum": 85
            },
            {
                "id": "3995913",
                "name": "家庭常备红外线耳温式体温计",
                "desc": "耳温式体温计测量更准确",
                "price": "139.00",
                "picture": "https://yanxuan-item.nosdn.127.net/cb09d868c280608a29c1d131dbc08061.jpg",
                "orderNum": 106
            },
            {
                "id": "3405016",
                "name": "无谷慕斯罐头（猫）170克*12罐",
                "desc": "三文鱼研磨，添加时令鱼籽",
                "price": "132.00",
                "picture": "https://yanxuan-item.nosdn.127.net/9736c4ff50a9481e527b27e8aad61f03.png",
                "orderNum": 118
            },
            {
                "id": "1435025",
                "name": "还原猫咪排泄天性，进口膨润土砂6千克",
                "desc": "进口矿砂，强力除臭凝结",
                "price": "59.00",
                "picture": "https://yanxuan-item.nosdn.127.net/4c271a733bb1461d39162c0d807b1b02.png",
                "orderNum": 90
            },
            {
                "id": "1109014",
                "name": "硅藻土皂托",
                "desc": "优质硅藻土，吸水速干护皂防潮",
                "price": "14.90",
                "picture": "https://yanxuan-item.nosdn.127.net/8809afb399a527e78e72cade7e32231d.jpg",
                "orderNum": 76
            },
            {
                "id": "1425006",
                "name": "西班牙里奥哈名庄之作，丹魄干红750毫升",
                "desc": "产区名庄，国际高分",
                "price": "98.00",
                "picture": "https://yanxuan-item.nosdn.127.net/1896e7452e0bc2a6c36175bb0c7a35c1.png",
                "orderNum": 193
            },
            {
                "id": "1418015",
                "name": "告别油腻解放双手，白色懒人抹布囤货装16卷",
                "desc": "16卷800节，用完即扔，洗碗打扫不脏手",
                "price": "109.00",
                "picture": "https://yanxuan-item.nosdn.127.net/d6cb861f6d112be2be4ee7c58745eb71.png",
                "orderNum": 58
            },
            {
                "id": "3988335",
                "name": "有效阻隔＞95%紫外线，儿童防晒衣4-15岁",
                "desc": "防晒UPF40+，清爽穿着无惧骄阳",
                "price": "86.43",
                "picture": "https://yanxuan-item.nosdn.127.net/6b5b323ae4365b42f82da67c5c011ca7.png",
                "orderNum": 114
            },
            {
                "id": "1113002",
                "name": "谷风一木3层硬抽3盒/提",
                "desc": "一纸三层，吸水耐用不易破",
                "price": "15.90",
                "picture": "https://yanxuan-item.nosdn.127.net/0f961546dde35328e7842afe11b98d79.jpg",
                "orderNum": 92
            }
        ]
    }
}
   */
